<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>添加</title>
    <link href="__STATIC__/component/pear/css/pear.css" rel="stylesheet"/>
</head>
<body class="childrenBody {:dialog_css()}">

<form class="layui-form" action="{:url('add')}" method="post">

    <div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">栏目</label>
	<div class="layui-input-block">{:form_select('tid', widget('model_field_options')->get(18), '', '')}</div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">标题</label>
	<div class="layui-input-block"><input type="text" name="title" value=""  lay-verify="required" placeholder="请输入标题" class="layui-input"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">标签</label>
	<div class="layui-input-block">{:form_select('tags_ids', widget('model_field_options')->get(62), '', ' xm-select="tags_ids" xm-select-skin="normal"')}</div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">封面</label>
	<div class="layui-input-block"><input type="hidden" id="thumb" name="thumb" value="" /><div class="upload-image layui-upload-drag aphp-upload" id="ID-upload-image-thumb" data-url="{:url('api/upload')}?api=thumb" data-accept="image" data-field="thumb"><img id="thumb-preview" src="" style="display:none;" width="90" height="60" alt="thumb">上传封面<span id="thumb-remove" class="remove-pic">删除</span></div><button type="button" class="layui-btn layui-btn-sm" id="thumb-selected" data-url="{:url('attach/selected')}?type=image&dialog=1">图库选择</button></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">内容</label>
	<div class="layui-input-block"><p style="color:#009688;">Tips：可复制图库中的图片地址插入编辑器。</p><textarea name="content" id="editor-content" placeholder="请输入内容" class="layui-textarea editor-tinymce" data-api="http://www.aphpv5.com/admin.php/api/upload.html?api=image"></textarea></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">摘要</label>
	<div class="layui-input-block"><textarea name="summary" id="editor-summary" placeholder="请输入摘要" class="layui-textarea"></textarea></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">购买链接</label>
	<div class="layui-input-block"><input type="text" name="url" value=""  lay-verify="url" placeholder="请输入购买链接" class="layui-input"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">置顶</label>
	<div class="layui-input-block"><input type="hidden" name="is_top" value="0" /><input type="checkbox" name="is_top" value="1" lay-skin="switch"  lay-text="是|否"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">发布时间</label>
	<div class="layui-input-block"><input type="text" name="post_time" value="{:date('Y-m-d H:i:s')}"  class="layui-input datetime" placeholder="请选择时间"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">浏览量</label>
	<div class="layui-input-block"><input type="number" name="read_count" value="0"  min="0" step="10" lay-affix="number" placeholder="请输入浏览量" class="layui-input"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">排序</label>
	<div class="layui-input-block"><input type="number" name="sort" value="100"  min="0" step="10" lay-affix="number" placeholder="请输入排序" class="layui-input"/></div>
</div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                添加
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script src="__STATIC__/component/layui/layui.js"></script>
<script src="__STATIC__/component/pear/pear.js"></script>
<script>
    layui.use(['aphpForm', 'aphp', 'form'], function () {
        var aphpForm = layui.aphpForm,
            aphp = layui.aphp,
            form = layui.form;

        aphpForm.bindEvent('form.layui-form');

        form.on('submit(save)', function (data) {
            aphp.request.postForm(data, 0, function () {
                parent.layer.close(parent.layer.getFrameIndex(window.name));
                parent.layui.table.reload('currentTable');
            });
            return false;
        });
    })
</script>
</body>
</html>